package com.example.user.pickviewdemo;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {

    private List<String> options1Items = new ArrayList<>();
    private List<String> options2Items = new ArrayList<>();
    private List<String> options3Items = new ArrayList<>();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        WheelView wvView = findViewById(R.id.wv_view);

        options1Items.add("_A_");
        options1Items.add("_B_");
        options1Items.add("_C_");
        options1Items.add("_D_");
        options1Items.add("_E_");
        options1Items.add("_A_");
        options1Items.add("_B_");
        options1Items.add("_C_");
        options1Items.add("_D_");
        options1Items.add("_E_");
        options1Items.add("_A_");
        options1Items.add("_B_");
        options1Items.add("_C_");
        options1Items.add("_D_");
        options1Items.add("_E_");
        options1Items.add("_A_");
        options1Items.add("_B_");
        options1Items.add("_C_");
        options1Items.add("_D_");
        options1Items.add("_E_");
        options1Items.add("_A_");
        options1Items.add("_B_");
        options1Items.add("_C_");
        options1Items.add("_D_");
        options1Items.add("_E_");

        wvView.setAdapter(new ArrayWheelAdapter(options1Items, 5));
        wvView.setOnItemSelectedListener(new OnItemSelectedListener() {
            @Override
            public void onItemSelected(int index) {
                Log.e("onItemSelectListener", index + ":" + options1Items.get(index));
            }
        });
        wvView.setCyclic(false);
    }
}
